/* 常见问题列表 */
UranusWei.controller("problem", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    $rootScope.Template = {
        title: '常见问题',
        state: 'problem',
        showbackicon: true,
        showheader: true,
        backlink: "/mine/more"
    }

    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }

    var initdata = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    initdata();
}]);
/* 常见问题详情 */
UranusWei.controller("problemdetail", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$location', '$window', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $location, $window) {
    $rootScope.Template = {
        title: '',
        state: 'problem',
        showbackicon: true,
        showheader: true,
    }
    var search = $location.search();
    var type = 0;
    if (search) {
        type = search.type;
    }
    $scope.type = type;
    if ($window.history.length <= 1) {
        $rootScope.Template.backlink = "/more/problem";
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    var banklimitList = CacheFactory.getStorage("banklimitList");
    if (banklimitList) {
        $scope.banklimitList = banklimitList;
    }
    commonFactory.ajax("/api/bank/GetBankLimitList", {}, function (result) {
        if (result.code == 1) {
            CacheFactory.setStorage("banklimitList", result.data);
            $scope.banklimitList = result.data;
        }
    }, function () {
        commonFactory.messageshow({ content: "<div class='bg_tan'>获取银行限额表失败</div>" });
    }, "post");
    var initdata = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    initdata();
}]);
/**媒体报道 */
UranusWei.controller("report", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$location', '$window', 'translider', '$stateParams', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $location, $window, translider, $stateParams) {
    $rootScope.Template = {
        title: '媒体报道',
        state: 'report',
        showbackicon: true,
        showheader: true,
        backlink: "/mine/more"
    }
    var dthis = new uranusiscroll();
    uranusiscroll = dthis.init(false, false);
    $timeout(function () {
        uranusiscroll.refresh();
    }, appconfig.pulldowntime);
}]);
/**媒体报道详情 */
UranusWei.controller("reportdetails", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$location', '$window', 'translider', '$stateParams', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $location, $window, translider, $stateParams) {
    $rootScope.Template = {
        title: '媒体报道',
        state: 'reportdetails',
        showbackicon: true,
        showheader: true,
        backlink: "/more/report"
    }
    var dthis = new uranusiscroll();
    uranusiscroll = dthis.init(false, false);
    $timeout(function () {
        uranusiscroll.refresh();
    }, appconfig.pulldowntime);
    $scope.showtime = $stateParams.time;
}]);
/**团队介绍 */
UranusWei.controller("team", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$location', '$window', 'translider', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $location, $window, translider) {
    $rootScope.Template = {
        title: '团队介绍',
        state: 'team',
        showbackicon: true,
        showheader: true,
        backlink: "/mine/more"
    }
    var dthis = new uranusiscroll();
    uranusiscroll = dthis.init(false, false);
    $timeout(function () {
        uranusiscroll.refresh();
    }, appconfig.pulldowntime);
}]);
// 关于我们
UranusWei.controller("aboutus", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    var linkurl = ''
    if ($rootScope.previousState && ($rootScope.previousState.url == '/home' || $rootScope.previousState.url == '/mine/more')) {
        if ($rootScope.previousState.url == '/home') {
            linkurl = '/main' + $rootScope.previousState.url;
        } else {
            linkurl = $rootScope.previousState.url;
        }

    }
    $rootScope.Template = {
        title: '关于我们',
        state: 'aboutus',
        showbackicon: true,
        showheader: true,
        backlink: linkurl
    }
    var dthis = new uranusiscroll();
    uranusiscroll = dthis.init(false, false);
    $timeout(function () {
        uranusiscroll.refresh();
    }, appconfig.pulldowntime);
    // 公司介绍是否显示全部 true为全部，false为主要部分
    $scope.moreshow = false;
    $scope.showtext = "查看更多";
    $scope.showtextclass = "showtext_01";
    $scope.showallORshowmain = function () {
        if ($scope.moreshow) {
            $scope.moreshow = false;
            $scope.showtext = "查看更多";
            $scope.showtextclass = "showtext_01";
        } else {
            $scope.moreshow = true;
            $scope.showtext = "收起";
            $scope.showtextclass = "showtext_02";
        }
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }

}]);
//大型国企入股
UranusWei.controller("hdhtml", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    $rootScope.Template = {
        title: '大型国企入股有利金服',
        state: 'hdhtml',
        showbackicon: true,
        showheader: true,
        backlink: "/main/home"
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    var initdata = function () {
        var infoimged = 0;
        $scope.imgInfoLoad = function () {
            infoimged++;
            if (infoimged == $scope.ProductInfo.ProductImages.length) {
                var imgs = document.getElementById("product_photo_show_hd");
                if (imgs) {
                    imgs = imgs.querySelectorAll(".js_layou_photos");
                    commonFactory.messagephotos(imgs, { shadeClose: true }, $scope);
                }
                $timeout(function () {
                    uranusiscroll.refresh();
                }, 250);
            }
        }
        var hd = document.getElementById("product_photo_show_hd");
        var hdimgs = null;
        var contracted = 0;
        $scope.imgContractLoad = function () {
            contracted++;
            if (!hd) {
                hd = document.getElementById("product_photo_show_hd");
            }
            if (hd) {
                hdimgs = hd.querySelectorAll(".js_layou_photos");
                if (contracted >= hdimgs.length) {
                    commonFactory.messagephotos(hdimgs, { shadeClose: true }, $scope);
                    $timeout(function () {
                        uranusiscroll.refresh();
                    }, 250);
                }
            }
        }
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }

    var loadimgcount = 0;
    $scope.imgload = function () {
        loadimgcount++;
        var imgs = document.getElementById("product_photo_show_hd");
        if (imgs) {
            imgs = imgs.querySelectorAll(".js_layou_photos");
        }
        if (loadimgcount >= imgs.length) {
            $timeout(function () {
                commonFactory.messagephotos(imgs, { shadeClose: true }, $scope);
            }, 200);
        }

        $timeout(function () {
            uranusiscroll.refresh();
        }, 250);
    }
    initdata();
}]);
//大型国企入股
UranusWei.controller("hdhtml0519", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    $rootScope.Template = {
        title: '大型国企入股有利金服',
        state: 'hdhtml0519',
        showbackicon: true,
        showheader: true,
        backlink: "/main/home"
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    var initdata = function () {
        var infoimged = 0;
        $scope.imgInfoLoad = function () {
            infoimged++;
            if (infoimged == $scope.ProductInfo.ProductImages.length) {
                var imgs = document.getElementById("product_photo_show_hd");
                if (imgs) {
                    imgs = imgs.querySelectorAll(".js_layou_photos");
                    commonFactory.messagephotos(imgs, { shadeClose: true }, $scope);
                }
                $timeout(function () {
                    uranusiscroll.refresh();
                }, 250);
            }
        }
        var hd = document.getElementById("product_photo_show_hd");
        var hdimgs = null;
        var contracted = 0;
        $scope.imgContractLoad = function () {
            contracted++;
            if (!hd) {
                hd = document.getElementById("product_photo_show_hd");
            }
            if (hd) {
                hdimgs = hd.querySelectorAll(".js_layou_photos");
                if (contracted >= hdimgs.length) {
                    commonFactory.messagephotos(hdimgs, { shadeClose: true }, $scope);
                    $timeout(function () {
                        uranusiscroll.refresh();
                    }, 250);
                }
            }
        }
        var cArr = ["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13"];
        var index = 1;
        var next = document.querySelector('.next');
        var prev = document.querySelector('.prev');
        var nextimg1 = document.querySelector('.nextImg');
        var previmg1 = document.querySelector('.prevImg');
        var oImg = document.querySelectorAll('img');
        var oNum = document.querySelector('#num')
        nextimg1.onclick = next.onclick = function () {
            nextimg();
            oNum.innerHTML = index
        }
        previmg1.onclick = prev.onclick = function () {
            previmg();
            oNum.innerHTML = index
        }
        //上一张
        function nextimg() {
            cArr.unshift(cArr[12]);
            cArr.pop();
            //i是元素的索引，从0开始
            //e为当前处理的元素
            //each循环，当前处理的元素移除所有的class，然后添加数组索引i的class
            for (i = 0; i < oImg.length; i++) {
                oImg[i].className = cArr[i];
            }
            index++;
            if (index > 13) {
                index = 1;
            }
        }
        //下一张
        function previmg() {
            cArr.push(cArr[0]);
            cArr.shift();
            for (i = 0; i < oImg.length; i++) {
                oImg[i].className = cArr[i];
            }
            index--;
            if (index <= 0) {
                index = 13;
            }
        }
        $timeout(function () {
            uranusiscroll.refresh();
        }, 250);
    }

    initdata();
}]);
//cctv大众生活
UranusWei.controller("hdyhtml", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    $rootScope.Template = {
        title: 'CCTV《大众生活》',
        state: 'hdyhtml',
        showbackicon: true,
        showheader: true,
        backlink: "/main/home"
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    var initdata = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    initdata();
}]);
//活动加息
UranusWei.controller("20170404", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', 'uranusPlus', '$interval', '$location', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, uranusPlus, $interval, $location) {
    if (window.location.pathname == "/hdhtml/hd20170525") {
        titleName = "六一儿童节加息狂欢"
    } else if (window.location.pathname == "/hdhtml/hd20180401") {
        titleName = "1周年庆典豪华礼遇"
    } else if (window.location.pathname == "/hdhtml/hd20180207") {
        titleName = "资金存管合作说明"
    } else if (window.location.pathname == "/hdhtml/hdranking") {
        titleName = "投资排行榜 宠爱有“礼”"
    } else if (window.location.pathname == "/hdhtml/hdzzyw") {
        titleName = "增值业务许可证"
    } else if (window.location.pathname == "/hdhtml/hd20180718") {
        titleName = "庆数据披露全面上线"
    } else {
        titleName = "全场加息狂欢活动"
    }
    $rootScope.Template = {
        title: titleName,
        state: '20170404',
        showbackicon: true,
        showheader: true,
        backlink: "/main/home"
    }
    commonFactory.setBackLink("/home/hotactives", ["/home/hotactives"]);
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    $timeout(function () {
        uranusiscroll.refresh();
    }, appconfig.pulldowntime);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }

    var initdata = function () {
        var cache_productlist = CacheFactory.getStorage("time_productlist");
        if (cache_productlist) {
            for (var i = 0; i < cache_productlist.length; i++) {
                if (cache_productlist[i].loanPeriod == 1 && cache_productlist[i].productStatus == 3) {
                    $scope.listOne = cache_productlist[i].id;
                } else if (cache_productlist[i].loanPeriod == 3 && cache_productlist[i].productStatus == 3) {
                    $scope.listThree = cache_productlist[i].id;
                } else if (cache_productlist[i].loanPeriod == 6 && cache_productlist[i].productStatus == 3) {
                    $scope.listSix = cache_productlist[i].id;
                }
            }
            $timeout(function () {
                uranusiscroll.refresh();
            }, 300);
        } else {
            // commonFactory.messageloading({ process: true });
        }
        commonFactory.ajax("/api/product/GetHdProductList", { pageindex: 1, pagesize: 10 }, function (result) {
            if (result.code == 1) {
                var data = result.data;
                $scope.listOne = "";
                $scope.listThree = "";
                $scope.listSix = "";
                for (var i = 0; i < data.length; i++) {
                    data[i].ServerTime = null;
                    if (data[i].loanPeriod == 1 && data[i].productStatus == 3) {
                        $scope.listOne = data[i].id;
                    } else if (data[i].loanPeriod == 3 && data[i].productStatus == 3) {
                        $scope.listThree = data[i].id;
                    } else if (data[i].loanPeriod == 6 && data[i].productStatus == 3) {
                        $scope.listSix = data[i].id;
                    }
                }
                if (!commonFactory.comparisonobj(data, cache_productlist)) {
                    // $scope.list = data.productCode;
                    CacheFactory.setStorage("time_productlist", data, { isExpires: true, expiresTime: CacheFactory.day * 1 });
                    $timeout(function () {
                        uranusiscroll.refresh();
                    }, 300);
                }
            }
        }, function () {

        }, "post");

    }
    if (window.location.pathname == "/hdhtml/hdranking" || window.location.pathname == "/hdhtml/hdgz") {
        var time_serial = CacheFactory.getStorage("time_serial")
        var time_hidehd = CacheFactory.getStorage("time_hidehd");
        if (time_hidehd && !time_hidehd.data && time_hidehd.data != undefined) {
            $scope.hdtime = false;
        } else {
            $scope.hdtime = true
        }
        if (time_serial) {////取当前期缓存
            $scope.serial = time_serial
        }
        var initMydata = function () {
            commonFactory.ajax("/api/Ranking/QueryRankingList", {}, function (res) {
                CacheFactory.setStorage("time_QueryRankingList", res.data, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                var sistartTime = new Date(new Date(res.data[0].startTime.replace(/-/g, '/')).getTime()); //服务器时间 第4期时间
                var siendTime = new Date(new Date(res.data[0].endTime.replace(/-/g, '/')).getTime()); //服务器时间 第4期时间
                var sistartdate = sistartTime.getDate();//开始时间
                var sienddate = siendTime.getDate();//结束时间
                if (sienddate == 1) {
                    sienddate = 31
                }
                var siendhours = siendTime.getHours();//结束时间
                var siserial = res.data[2].serial//期数
                commonFactory.ajax("/api/bank/gettime", {}, function (result) {
                    if (result.code == 1) {
                        var severseTime = new Date(new Date(result.data.replace(/-/g, '/')).getTime()); //服务器时间
                        var month = severseTime.getMonth() + 1;
                        var date = severseTime.getDate();
                        if (month == 7 && date >= sistartdate && date <= sienddate) {//进行中
                            thisSerial(4);
                            $scope.hdtime = true
                            timeShow(sistartdate, siendTime, result.data);
                            $scope.serial = '4';//根据期数显示banner
                            CacheFactory.setStorage("time_serial", $scope.serial, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                            CacheFactory.setStorage("time_hidehd", $scope.hdtime, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                        } else if (month == 6) {//活动未开始
                            $scope.serial = '4';//根据期数显示banner
                            $scope.weibegin = true;
                            $scope.hdtime = 2;
                            thisSerial(4);
                            $scope.begindjsdate = '00';//日期
                            $scope.begindjshousr = '00';;//小时
                            $scope.begindjsmin = '00'; //分钟
                            $scope.begindjssec = '00'; //秒
                        } else {//活动结束
                            thisSerial(4);
                            $scope.hdtime = false;//活动结束
                            CacheFactory.setStorage("time_hidehd", $scope.hdtime, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                            $scope.serial = '0'//根据期数显示banner
                            CacheFactory.setStorage("time_serial", $scope.serial, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                            $scope.gztime = '2018年5月22日 0点--2018年5月31日24点';//活动规则中的时间;
                        }
                    }
                }, function () { }, 'post')
            }, function () { }, 'post');
        }
        initMydata();
        var rankingDetailInfost = CacheFactory.getStorage("time_rankingDetailInfost")
        if (rankingDetailInfost) {////取当前期缓存
            $scope.rankingDetailInfos = rankingDetailInfost
            $scope.UserId = rankingDetailInfost.userId;
        }
        var thisSerial = function (type) {
            commonFactory.ajax("/api/Ranking/GetRankingDetail", { Serial: type, UserId: '0' }, function (result) {
                if (result.code == 1) {
                    $scope.GetRankingDetail = result.data;
                    result.data.rankingDetailInfos.forEach(function (ele) {
                        if (ele.fullName) {
                            ele.fullName = ele.fullName.substring(0, 1);//取姓氏
                            if (!ele.sex) {
                                ele.fullName = ele.fullName + '女士';
                            } else {
                                ele.fullName = ele.fullName + '先生';
                            }
                        }
                    })
                    if (!commonFactory.comparisonobj(rankingDetailInfost, result.data)) {//判断新老缓存是否一致 不一致替换最新数据
                        $scope.rankingDetailInfos = result.data.rankingDetailInfos;
                        $scope.UserId = result.data.userId;
                        CacheFactory.setStorage("time_rankingDetailInfost", result.data, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                    }
                    $timeout(function () {
                        uranusiscroll.refresh();
                    }, appconfig.pulldowntime);
                } else if (result.code == 8) {
                    $scope.rankingDetailInfos = new Array(10);
                    $timeout(function () {
                        uranusiscroll.refresh();
                    }, appconfig.pulldowntime);
                }
            }, function () {

            }, "post");
        };
        function timeShow(startDate, endtime, data) {
            $scope.djstimes = new Date(data.replace(/-/g, '/')).getTime();//当前服务器时间戳
            var ndate = new Date(new Date(data.replace(/-/g, '/')).getTime()); //服务器时间;
            var year = ndate.getFullYear();
            var month = ndate.getMonth() + 1;
            var off = true
            if (ndate.getHours() == '00' && off) {//
                var pretime = new Date(new Date(data.replace(/-/g, '/')).getTime() - 86400000)
                date = pretime.getDate();
                month = pretime.getMonth() + 1;
                off = false;
            }
            var newDate = year + '-' + month + '-' + startDate + ' ' + 00 + ':' + 00 + ':' + 00;
            $scope.newDate = new Date(newDate.replace(/-/g, '/')).getTime();//开始时间戳

            var enddjs = new Date(endtime).getTime() - $scope.newDate;//时间段
            var cdate = new Date(endtime).getTime();//当前活动结束时间戳
            function djsminutes() {
                if ($scope.djstimes >= cdate) {
                    $interval.cancel(clear);
                    initMydata()
                }
                djsdate = parseInt(enddjs / 86400000);
                djshours = parseInt(enddjs % 86400000 / 3600000);
                djsmin = parseInt(enddjs % 3600000 / 60000);
                djssec = parseInt(enddjs % 60000 / 1000);
                if (djsdate.toString().length == 1) {
                    djsdate = '0' + djsdate;
                }
                if (djshours.toString().length == 1) {
                    djshours = '0' + djshours;
                }
                if (djsmin.toString().length == 1) {
                    djsmin = '0' + djsmin;
                }
                if (djssec.toString().length == 1) {
                    djssec = '0' + djssec;
                }

                if (djssec && djsmin) {
                    $scope.begindjsdate = djsdate//日期
                    $scope.begindjshousr = djshours;//小时
                    $scope.begindjsmin = djsmin //分钟
                    $scope.begindjssec = djssec //秒
                } else if (!djssec && djsmin) {
                    $scope.begindjsdate = djsdate//日期
                    $scope.begindjshousr = djshours;//小时
                    $scope.begindjsmin = djsmin //分钟
                    $scope.begindjssec = djssec //秒
                } else if (!djsmin) {
                    $scope.begindjsdate = djsdate//日期
                    $scope.begindjshousr = djshours;//小时
                    $scope.begindjsmin = djsmin //分钟
                    $scope.begindjssec = djssec //秒
                }
            }
            if ($scope.djstimes >= $scope.newDate && $scope.djstimes <= cdate) {//判断是否开始倒计时  服务器时间戳》=开始时间戳&& 服务器时间戳《=结束时间戳
                thisdjs = $scope.djstimes - $scope.newDate;//当前时间-设定时间=剩余时间
                enddjs = enddjs - thisdjs;
                djsminutes()
                var clear = $interval(function () {
                    enddjs -= 1000;
                    $scope.djstimes += 1000;
                    djsminutes();
                }, 1000)
            }
        }
    } else if (window.location.pathname == "/hdhtml/hdprevious") {
        var rankingDetailInfosts = CacheFactory.getStorage("time_rankingDetailInfosts")
        if (rankingDetailInfosts) {//取第一期缓存
            $scope.rankingDetailInfos = rankingDetailInfost
        }
        var rankingDetailInfosecond = CacheFactory.getStorage("time_rankingDetailInfosecond")
        if (rankingDetailInfosecond) {//取第二期缓存
            $scope.rankingDetailInfos = rankingDetailInfosecond
        }
        commonFactory.ajax("/api/Ranking/GetRankingDetail", { Serial: 1, UserId: '0' }, function (result) {
            if (result.code == 1) {
                result.data.rankingDetailInfos.forEach(function (ele) {
                    if (ele.fullName) {
                        ele.fullName = ele.fullName.substring(0, 1);//取姓氏
                        if (!ele.sex) {
                            ele.fullName = ele.fullName + '女士';
                        } else {
                            ele.fullName = ele.fullName + '先生';
                        }
                    }
                })
                if (!commonFactory.comparisonobj(rankingDetailInfost, result.data.rankingDetailInfos)) {//判断新老缓存是否一致 不一致替换最新数据
                    $scope.rankingDetailInfos = result.data.rankingDetailInfos;//第一期数据
                    CacheFactory.setStorage("time_rankingDetailInfosts", result.data.rankingDetailInfos, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                }

                $timeout(function () {
                    uranusiscroll.refresh();
                }, appconfig.pulldowntime);
            } else if (result.code == 8) {
            }

        }, function () {

        }, "post");
        var showTwoSerial = CacheFactory.getStorage("time_QueryRankingList");
        if (showTwoSerial[0].startTime) {//往期记录第二期显示的判断时间
            var startTime = new Date(new Date(showTwoSerial[0].startTime.replace(/-/g, '/')).getTime()); //服务器时间 第二期时间
            var startdate = startTime.getDate();//开始时间
        }
        commonFactory.ajax("/api/bank/gettime", {}, function (res) {
            var startgettime = new Date(new Date(res.data.replace(/-/g, '/')).getTime()); //服务器时间 第二期时间
            var startgetdate = startgettime.getDate();//开始时间
            var startgetmonth = startgettime.getMonth() + 1;//开始时间
            if (startgetdate >= startdate || startgetmonth > 5) {//服务器当前时间比较第二期结束时间  > 显示 < 不显示
                commonFactory.ajax("/api/Ranking/GetRankingDetail", { Serial: 2, UserId: '0' }, function (result) {
                    if (result.code == 1) {
                        result.data.rankingDetailInfos.forEach(function (ele) {
                            if (ele.fullName) {
                                ele.fullName = ele.fullName.substring(0, 1);//取姓氏
                                if (!ele.sex) {
                                    ele.fullName = ele.fullName + '女士';
                                } else {
                                    ele.fullName = ele.fullName + '先生';
                                }
                            }
                        })
                        if (!commonFactory.comparisonobj(rankingDetailInfost, result.data.rankingDetailInfos)) {//判断新老缓存是否一致 不一致替换最新数据
                            $scope.rankingDetailInfosecond = result.data.rankingDetailInfos;//第二期数据
                            CacheFactory.setStorage("time_rankingDetailInfosecond", result.data.rankingDetailInfos, { isExpires: true, expiresTime: CacheFactory.hour * 48 });
                        }

                        $timeout(function () {
                            uranusiscroll.refresh();
                        }, appconfig.pulldowntime);
                    } else if (result.code == 8) {
                        //往期不存在code==8
                    }

                }, function () {

                }, "post");
            }

        }, function () {

        }, "post");
    } else {
        initdata();
    }
    $scope.imgload = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }

}]);
// 新手指导
UranusWei.controller("hd20170410", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    if (window.location.pathname == "/hdhtml/end20170901") {
        titleName = "充值流程"
    } else if (window.location.pathname == "/banner/tjwh") {
        titleName = "停机维护公告"
    } else if (window.location.pathname == "/gqfj") {
        titleName = "2017年国庆节和中秋节放假公告"
    } else {
        titleName = "多重保障"
    }
    $rootScope.Template = {
        title: titleName,
        state: 'endbanner',
        showbackicon: true,
        showheader: true,
        // backlink: "/mine/more"
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    var initdata = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
        //交易总额
        commonFactory.ajax("/api/Product/GetTransactionData", {}, function (result) {
            if (result.code == 1) {
                $scope.GetTransactionData = result.data;
            } else if (result.code == 2) {
                commonFactory.messageshow({ content: "<div class='bg_tan'>查询失败</div>" });
            }
        }, function () {
            commonFactory.messageshow({ content: "<div class='bg_tan'>后台错误</div>" });
        }, "post");
    }
    initdata();
}]);
// 富民银行托管
UranusWei.controller("fmbank", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory) {
    if (window.location.pathname == "/hdhtml/sjsafe") {
        titleName = "荣获国家信息安全证书"
    } else if (window.location.pathname == "/hdhtml/gansafe") {
        titleName = "公安网备案"
    } else {
        titleName = "富民银行存管"
    }
    $rootScope.Template = {
        title: titleName,
        state: 'fmbank',
        showbackicon: true,
        showheader: true,
        backlink: "/main/home"
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    var initdata = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
        var infoimged = 0;
        $scope.imgInfoLoad = function () {
            infoimged++;
            if (infoimged == $scope.ProductInfo.ProductImages.length) {
                var imgs = document.getElementById("product_photo_show_hd");
                if (imgs) {
                    imgs = imgs.querySelectorAll(".js_layou_photos");
                    commonFactory.messagephotos(imgs, { shadeClose: true }, $scope);
                }
                $timeout(function () {
                    uranusiscroll.refresh();
                }, 250);
            }
        }
        var hd = document.getElementById("product_photo_show_hd");
        var hdimgs = null;
        var contracted = 0;
        $scope.imgContractLoad = function () {
            contracted++;
            if (!hd) {
                hd = document.getElementById("product_photo_show_hd");
            }
            if (hd) {
                hdimgs = hd.querySelectorAll(".js_layou_photos");
                if (contracted >= hdimgs.length) {
                    commonFactory.messagephotos(hdimgs, { shadeClose: true }, $scope);
                    $timeout(function () {
                        uranusiscroll.refresh();
                    }, 250);
                }
            }
        }
    }
    initdata();
}]);
//关注微信流程
UranusWei.controller("weixin", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', 'uranusPlus', '$interval', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, uranusPlus, $interval) {
    if (window.location.pathname == "/hdhtml/hd20170525") {
        titleName = "六一儿童节加息狂欢"
    } else {
        titleName = "全场加息狂欢活动"
    }
    $rootScope.Template = {
        title: titleName,
        state: 'weixin',
        showbackicon: false,
        showheader: false,
        backlink: "/main/home"
    }
    var dthis = new uranusiscroll();
    // var text = commonFactory.GetRandomPullAd();
    uranusiscroll = dthis.init(false, false);
    $timeout(function () {
        uranusiscroll.refresh();
    }, appconfig.pulldowntime);
}]);
UranusWei.controller("infodis", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'uranusPlus', 'appconfig', '$timeout', '$interval', '$stateParams', 'CacheFactory', '$location', function ($scope, $rootScope, uranusiscroll, commonFactory, uranusPlus, appconfig, $timeout, $interval, $stateParams, CacheFactory, $location) {
    $rootScope.Template = {
        title: '信息披露',
        state: 'infodis',
        showbackicon: true,
        showheader: true,
        backlink: '/main/home'
    }
    var dthis = new uranusiscroll();
    uranusiscroll = dthis.init(false, false, true, true);
    $timeout(function () {
        uranusiscroll.refresh();
    }, 300);
    $scope.showtype = 1;//显示的tab
    //优化每次切换选项时
    var js_title = document.querySelector("#js_title");
    if (js_title) {
        initposition = js_title.getBoundingClientRect();
    }
    $scope.ShowType = function (type) {
        $scope.showtype = type;
        uranusiscroll.scrollTo(0, 0, 3);
        $timeout(function () {
            uranusiscroll.refresh();
        }, 300);
    }
    // 公司介绍是否显示全部 true为全部，false为主要部分
    $scope.moreshow = false;
    $scope.showtext = "查看更多";
    $scope.showtextclass = "showtext_01";
    $scope.showallORshowmain = function () {
        if ($scope.moreshow) {
            $scope.moreshow = false;
            $scope.showtext = "查看更多";
            $scope.showtextclass = "showtext_01";
        } else {
            $scope.moreshow = true;
            $scope.showtext = "收起";
            $scope.showtextclass = "showtext_02";
        }
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }


    var initdata = function () {
       
    }
    initdata();
}]);